<template>
	<view style="padding-bottom: 100rpx;">
		<u-navbar v-if="!$isWeixin()" :customBack="backToList" :title="title" :titleBold="true" :is-fixed="true" :background="{ backgroundColor: '#fff' }"></u-navbar>

		<u-tabs activeColor="#FF7A23" :list="tabList" :current="tabIndex" @change="index => (tabIndex = index)"></u-tabs>

		<view class="" v-if="ShowLevel != 3">
			<!-- <relations v-if="tabIndex == 0" :list="This_Dealer_RelationList"></relations> -->

			<!-- 基础信息 -->
			<view class="" v-if="tabIndex == 0">
				<u-cell-item v-if="ShowLevel == 2" :border-bottom="false" title="一级经销商名称" :arrow="false" :value="First_Dealer_BaseInfo.Name"></u-cell-item>
				<basic-information
					:selectedFields="selectedFields"
					:displayAll="false"
					:level="ShowLevel"
					:data="DoubleDealerInfo"
					:showDeliveryAddress="false"
					:metadata="DataBaseInfo"
					:showParent="false"
					:showReview="false"
					:showKeDealerNo="true"
					:loadCity="loadCity"
					:showSalesInfo="false"
				></basic-information>
			</view>

			<!-- 产品信息 -->
			<view class="" v-if="tabIndex == 1">
				<!-- <u-cell-item v-if="selectedFields.includes(58)" required :arrow="false" title="渠道类型">
					<u-radio-group v-model="This_Dealer_OtherInfo.ChannelType" disabled>
						<view class="grid-2">
							// 1：渠道   2：售后   3：渠道+售后   4：供应商   5：公司  6：其他
							<u-radio name="1">渠道</u-radio>
							<u-radio name="2">售后</u-radio>
							<u-radio name="3">渠道+售后</u-radio>
							<u-radio name="4">供应商</u-radio>
							<u-radio name="5">公司</u-radio>
							<u-radio name="6">其他</u-radio>
						</view>
					</u-radio-group>
				</u-cell-item> -->

				<u-cell-item v-if="selectedFields.includes(59) && ShowLevel == 1" required :arrow="false" title="类型">
					<u-checkbox-group>
						<view class="grid-2">
							<u-checkbox  v-model="item.checked" v-for="(item, index) in First_Type_List" :name="item.Key" :key="index">
								{{ item.Value }}
							</u-checkbox>
						</view>
					</u-checkbox-group>
				</u-cell-item>

				<u-cell-item v-if="selectedFields.includes(8) || displayAll" :arrow="false" :title="addPrefix('属性')">
					<u-radio-group :value="This_Dealer_OtherInfo.DealerType">
						<view class="grid-2">
							<u-radio :disabled="true" v-for="(item, index) in DataBaseInfo.DealerType_BaseList" :key="index" :name="item.Key">{{ item.Value }}</u-radio>
						</view>
					</u-radio-group>
				</u-cell-item>
				<u-cell-item v-if="selectedFields.includes(9) || displayAll" :arrow="false" :title="addPrefix('经营品类')">
					<u-checkbox-group>
						<view class="grid-2">
							<u-checkbox :disabled="true" v-model="item.checked" v-for="(item, index) in DataBaseInfo.BusinessCategory_BaseList" :name="item.Key" :key="index">
								{{ item.Value }}
							</u-checkbox>
						</view>
					</u-checkbox-group>
				</u-cell-item>
				<u-cell-item
					v-if="!displayAll && (selectedFields.includes(10) || selectedFields.includes(11) || selectedFields.includes(12))"
					:arrow="false"
					:title="addPrefix('竞品品牌')"
				>
					<block v-if="selectedFields.includes(10) || displayAll">
						<view class="u-text-left u-p-l-20">BDR品牌数: {{ count_A }}</view>
						<u-checkbox-group>
							<view class="grid-2">
								<u-checkbox :disabled="true" v-model="item.checked" v-for="(item, index) in DataBaseInfo.CompetingGoodsBrandA_BaseList" :key="index" :name="item.Key">
									{{ item.Value }}
								</u-checkbox>
							</view>
						</u-checkbox-group>
						<u-line></u-line>
					</block>

					<block v-if="selectedFields.includes(11) || displayAll">
						<view class="u-text-left u-p-l-20">进口品牌数: {{ count_B }}</view>
						<u-checkbox-group>
							<view class="grid-2">
								<u-checkbox
									:disabled="true"
									v-model="item.checked"
									class="grid-item"
									v-for="(item, index) in DataBaseInfo.CompetingGoodsBrandB_BaseList"
									:key="index"
									:name="item.Key"
								>
									{{ item.Value }}
								</u-checkbox>
							</view>
						</u-checkbox-group>
						<u-line></u-line>
					</block>

					<block v-if="selectedFields.includes(12) || displayAll">
						<view class="u-text-left u-p-l-20">国产品牌数: {{ count_C }}</view>
						<u-checkbox-group>
							<view class="grid-2">
								<u-checkbox :disabled="true" v-model="item.checked" v-for="(item, index) in DataBaseInfo.CompetingGoodsBrandC_BaseList" :key="index" :name="item.Key">
									{{ item.Value }}
								</u-checkbox>
							</view>
						</u-checkbox-group>
					</block>
				</u-cell-item>
			</view>

			<!-- 销售信息 -->
			<view v-if="tabIndex == 2">
				<u-cell-item v-if="(selectedFields.includes(13) || displayAll) && ShowLevel != 3" :arrow="false" :title="addPrefix('上年BDR销售额')">
					<view class="u-flex-col u-col-bottom">
						<view>
							<text>{{ This_Dealer_OtherInfo.LastYearsBDRSales }}</text>
							<text class="unit u-m-l-32">万元</text>
						</view>
						<text class="desc">*BDR品牌的年销售额，新开的可预估</text>
					</view>
				</u-cell-item>

				<u-cell-item v-if="(selectedFields.includes(14) || displayAll) && ShowLevel != 3" :arrow="false" :title="addPrefix('总销售额')">
					<view class="u-flex-col u-col-bottom">
						<view>
							<text>{{ This_Dealer_OtherInfo.TotalSales }}</text>
							<text class="unit u-m-l-32">万元</text>
						</view>
						<text class="desc">*所有品类的年销售额</text>
					</view>
				</u-cell-item>
				<!-- <u-cell-item :arrow="false" :title="addPrefix('BDR销售额占比')">
					<view class="u-flex-col u-col-bottom">
						<view>
							<text>{{ data.Dealer_OtherInfo.PercentageBDRSales }}</text>
							<text class="unit">%</text>
						</view>
						<text class="desc">*上年BDR销售额/总销售额</text>
					</view>
				</u-cell-item> -->
			</view>

			<!-- boss信息 -->
			<view class="" v-if="tabIndex == 3"><boss-information :selectedFields="selectedFields" :displayAll="false" :level="2" :data="This_Dealer_OtherInfo"></boss-information></view>

			<view class="" v-if="tabIndex == 4"><review-info :data="DealerAuditInfo"></review-info></view>
		</view>

		<view class="" v-show="ShowLevel == 3">
			<!-- <relations v-if="tabIndex == 0 && selectedFields.includes(0)" :list="This_Dealer_RelationList"></relations> -->

			<view v-show="tabIndex == 0">
				<block v-if="selectedFields.includes(1)">
					<u-cell-item :border-bottom="false" title="一级经销商名称" :arrow="false" :value="First_Dealer_BaseInfo.Name"></u-cell-item>
					<u-cell-item :border-bottom="false" title="二级经销商名称" :arrow="false" :value="Double_Dealer_BaseInfo.Name"></u-cell-item>
				</block>

				<basic-information
					:selectedFields="selectedFields"
					:displayAll="false"
					:level="3"
					:showDeliveryAddress="false"
					:data="DoubleDealerInfo"
					:metadata="DataBaseInfo"
					:showParent="false"
					:showReview="false"
					:showKeDealerNo="false"
					:loadCity="loadCity"
					:showSalesInfo="false"
				></basic-information>

				<block v-if="selectedFields.includes(16)">
					<u-cell-item title="人员数量" :arrow="false" style="" :border-bottom="false"></u-cell-item>

					<u-cell-item title="" :arrow="false">
						<view class="u-flex u-text-right" v-for="(item, index) in form.DealerPeopleNumList" :key="index">
							<u-input disabled v-model="item.Title" placeholder="请输入标题" :border="true" :height="50"></u-input>
							<text class="u-m-20">:</text>
							<u-input disabled v-model="item.Num" type="number" placeholder="数量" :border="true" :height="50"></u-input>
						</view>
					</u-cell-item>
				</block>
			</view>

			<!-- 产品信息 -->
			<view class="" v-if="tabIndex == 1">
				<u-cell-item v-if="selectedFields.includes(8) || displayAll" :arrow="false" :title="addPrefix('属性')">
					<u-radio-group :value="This_Dealer_OtherInfo.DealerType">
						<view class="grid-2">
							<u-radio :disabled="true" v-for="(item, index) in DataBaseInfo.DealerType_BaseList" :key="index" :name="item.Key">{{ item.Value }}</u-radio>
						</view>
					</u-radio-group>
				</u-cell-item>
				<u-cell-item v-if="selectedFields.includes(9) || displayAll" :arrow="false" :title="addPrefix('经营品类')">
					<u-checkbox-group>
						<view class="grid-2">
							<u-checkbox :disabled="true" v-model="item.checked" v-for="(item, index) in DataBaseInfo.BusinessCategory_BaseList" :name="item.Key" :key="index">
								{{ item.Value }}
							</u-checkbox>
						</view>
					</u-checkbox-group>
				</u-cell-item>
				<u-cell-item
					v-if="!displayAll && (selectedFields.includes(10) || selectedFields.includes(11) || selectedFields.includes(12))"
					:arrow="false"
					:title="addPrefix('竞品品牌')"
				>
					<block v-if="selectedFields.includes(10) || displayAll">
						<view class="u-text-left u-p-l-20">BDR品牌数: {{ count_A }}</view>
						<u-checkbox-group>
							<view class="grid-2">
								<u-checkbox :disabled="true" v-model="item.checked" v-for="(item, index) in DataBaseInfo.CompetingGoodsBrandA_BaseList" :key="index" :name="item.Key">
									{{ item.Value }}
								</u-checkbox>
							</view>
						</u-checkbox-group>
						<u-line></u-line>
					</block>

					<block v-if="selectedFields.includes(11) || displayAll">
						<view class="u-text-left u-p-l-20">进口品牌数: {{ count_B }}</view>
						<u-checkbox-group>
							<view class="grid-2">
								<u-checkbox
									:disabled="true"
									v-model="item.checked"
									class="grid-item"
									v-for="(item, index) in DataBaseInfo.CompetingGoodsBrandB_BaseList"
									:key="index"
									:name="item.Key"
								>
									{{ item.Value }}
								</u-checkbox>
							</view>
						</u-checkbox-group>
						<u-line></u-line>
					</block>

					<block v-if="selectedFields.includes(12) || displayAll">
						<view class="u-text-left u-p-l-20">国产品牌数: {{ count_C }}</view>
						<u-checkbox-group>
							<view class="grid-2">
								<u-checkbox :disabled="true" v-model="item.checked" v-for="(item, index) in DataBaseInfo.CompetingGoodsBrandC_BaseList" :key="index" :name="item.Key">
									{{ item.Value }}
								</u-checkbox>
							</view>
						</u-checkbox-group>
					</block>
				</u-cell-item>

				<block v-if="selectedFields.includes(21)">
					<u-cell-item title="竞品出样情况" :arrow="false" :border-bottom="false">
						<u-radio-group disabled v-model="form.VisitRecordInfo.Sampling">
							<u-radio name="1">是</u-radio>
							<u-radio name="2">否</u-radio>
						</u-radio-group>
					</u-cell-item>

					<u-cell-item title="" style="padding: 0;" :arrow="false">
						<view class="u-m-20" v-if="form.VisitRecordInfo.Sampling == 1">
							<view class="samling-item" v-for="(item, index) in form.VisitRecordInfo.DealerSamplingSellList" :key="index">
								<u-input disabled v-model="item.BrandName" :border="true"></u-input>
								<u-input disabled v-model="item.ProductModel" class="u-m-t-10" :border="true"></u-input>
								<u-input disabled class="u-m-t-10" type="number" :border="true" placeholder="数量" v-model="item.Number"></u-input>

								<u-gap bg-color="#f5f5f5" class="u-m-t-10 u-m-b-10" :height="10"></u-gap>
							</view>
						</view>
					</u-cell-item>
				</block>

				<block v-if="selectedFields.includes(23)">
					<u-cell-item title="样机情况" :arrow="false" :border-bottom="false"></u-cell-item>
					<u-cell-item style="padding: 0;" :arrow="false">
						<view class="u-m-20">
							<view class="samling-item" v-for="(item, index) in form.VisitRecordInfo.DealerVisitSellList" :key="index">
								<u-input
									disabled
									type="select"
									:value="item.BrandName"
									:border="true"
									@tap="(showVisitSellPicker = true), (currentVisitSellIndex = index)"
									:selectOpen="showVisitSellPicker"
								></u-input>
								<u-input
									disabled
									:value="item.productName"
									class="u-m-t-10"
									type="select"
									@tap="(showVisitSellProductPicker = true), (currentVisitSellIndex = index)"
									:selectOpen="showVisitSellProductPicker"
									:border="true"
								></u-input>
								<u-input disabled class="u-m-t-10" type="number" :border="true" placeholder="数量" v-model="item.Number"></u-input>

								<u-gap bg-color="#f5f5f5" class="u-m-t-10 u-m-b-10" :height="10"></u-gap>
							</view>
						</view>
					</u-cell-item>
				</block>
			</view>

			<!-- 销售信息 -->
			<view v-if="tabIndex == 2">
				<u-cell-item v-if="(selectedFields.includes(13) || displayAll) && ShowLevel != 3" :arrow="false" title="上年BDR销售额">
					<view class="u-flex-col u-col-bottom">
						<view>
							<text>{{ This_Dealer_OtherInfo.LastYearsBDRSales }}</text>
							<text class="unit u-m-l-32">万元</text>
						</view>
						<text class="desc">*BDR品牌的年销售额，新开的可预估</text>
					</view>
				</u-cell-item>

				<u-cell-item v-if="(selectedFields.includes(14) || displayAll) && ShowLevel != 3" :arrow="false" title="总销售额">
					<view class="u-flex-col u-col-bottom">
						<view>
							<text>{{ This_Dealer_OtherInfo.TotalSales }}</text>
							<text class="unit u-m-l-32">万元</text>
						</view>
						<text class="desc">*所有品类的年销售额</text>
					</view>
				</u-cell-item>

				<u-cell-item v-if="(selectedFields.includes(13) || displayAll) && ShowLevel != 3" :arrow="false" title="上年BDR销售额">
					<view class="u-flex-col u-col-bottom">
						<view>
							<text>{{ This_Dealer_OtherInfo.LastYearsBDRSales }}</text>
							<text class="unit u-m-l-32">万元</text>
						</view>
						<text class="desc">*BDR品牌的年销售额，新开的可预估</text>
					</view>
				</u-cell-item>

				<u-cell-item v-if="(selectedFields.includes(14) || displayAll) && ShowLevel != 3" :arrow="false" title="总销售额">
					<view class="u-flex-col u-col-bottom">
						<view>
							<text>{{ This_Dealer_OtherInfo.Dealer_OtherInfo.TotalSales }}</text>
							<text class="unit u-m-l-32">万元</text>
						</view>
						<text class="desc">*所有品类的年销售额</text>
					</view>
				</u-cell-item>
				<!-- <u-cell-item :arrow="false" :title="addPrefix('BDR销售额占比')">
									<view class="u-flex-col u-col-bottom">
										<view>
											<text>{{ data.Dealer_OtherInfo.PercentageBDRSales }}</text>
											<text class="unit">%</text>
										</view>
										<text class="desc">*上年BDR销售额/总销售额</text>
									</view>
								</u-cell-item> -->

				<u-cell-item v-if="selectedFields.includes(34) || displayAll" :arrow="false" title="上一年对应代理商供暖销售额">
					<view class="u-flex-col u-col-bottom">
						<view class="u-flex">
							<u-input disabled v-model="This_Dealer_OtherInfo.LY_DealerHeatingSales" type="number" inputAlign="right" placeholder="请输入"></u-input>
							<text class="unit u-m-l-32">万元</text>
						</view>
					</view>
				</u-cell-item>

				<u-cell-item v-if="selectedFields.includes(35) || displayAll" :arrow="false" title="上一年对应代理商空凋销售额">
					<view class="u-flex-col u-col-bottom">
						<view class="u-flex">
							<u-input disabled v-model="This_Dealer_OtherInfo.LY_DealerAirConditionerSales" type="number" inputAlign="right" placeholder="请输入"></u-input>
							<text class="unit u-m-l-32">万元</text>
						</view>
					</view>
				</u-cell-item>

				<u-cell-item v-if="selectedFields.includes(36) || displayAll" :arrow="false" title="上一年对应代理商净水销售额">
					<view class="u-flex-col u-col-bottom">
						<view class="u-flex">
							<u-input disabled v-model="This_Dealer_OtherInfo.LY_DealerPurifiedWaterSales" type="number" inputAlign="right" placeholder="请输入"></u-input>
							<text class="unit u-m-l-32">万元</text>
						</view>
					</view>
				</u-cell-item>

				<u-cell-item v-if="selectedFields.includes(50) || displayAll" :arrow="false" title="上一年门店供暖销售额">
					<view class="u-flex-col u-col-bottom">
						<view class="u-flex">
							<u-input disabled v-model="This_Dealer_OtherInfo.LY_StoreHeatingSales" type="number" inputAlign="right" placeholder="请输入"></u-input>
							<text class="unit u-m-l-32">万元</text>
						</view>
					</view>
				</u-cell-item>

				<u-cell-item v-if="selectedFields.includes(51) || displayAll" :arrow="false" title="上一年门店空凋销售额">
					<view class="u-flex-col u-col-bottom">
						<view class="u-flex">
							<u-input disabled v-model="This_Dealer_OtherInfo.LY_StoreAirConditionerSales" type="number" inputAlign="right" placeholder="请输入"></u-input>
							<text class="unit u-m-l-32">万元</text>
						</view>
					</view>
				</u-cell-item>

				<u-cell-item v-if="selectedFields.includes(52) || displayAll" :arrow="false" title="上一年门店净水销售额">
					<view class="u-flex-col u-col-bottom">
						<view class="u-flex">
							<u-input disabled v-model="This_Dealer_OtherInfo.LY_Store_BDR_PurifiedWaterSales" type="number" inputAlign="right" placeholder="请输入"></u-input>
							<text class="unit u-m-l-32">万元</text>
						</view>
					</view>
				</u-cell-item>

				<u-cell-item v-if="selectedFields.includes(53) || displayAll" :arrow="false" title="上一年销售BDR供暖产品台数">
					<view class="u-flex-col u-col-bottom">
						<view class="u-flex">
							<u-input disabled v-model="This_Dealer_OtherInfo.LY_Store_BDR_HeatingSalesNum" type="number" inputAlign="right" placeholder="请输入"></u-input>
							<text class="unit u-m-l-32">台</text>
						</view>
					</view>
				</u-cell-item>

				<u-cell-item v-if="selectedFields.includes(54) || displayAll" :arrow="false" title="上一年销售BDR净水产品台数">
					<view class="u-flex-col u-col-bottom">
						<view class="u-flex">
							<u-input disabled v-model="This_Dealer_OtherInfo.LY_Store_BDR_AirConditionerSalesNum" type="number" inputAlign="right" placeholder="请输入"></u-input>
							<text class="unit u-m-l-32">台</text>
						</view>
					</view>
				</u-cell-item>

				<u-cell-item v-if="selectedFields.includes(55) || displayAll" :arrow="false" title="上一年销售BDR热泵产品台数">
					<view class="u-flex-col u-col-bottom">
						<view class="u-flex">
							<u-input disabled v-model="This_Dealer_OtherInfo.LY_Store_BDR_PurifiedWaterSalesNum" type="number" inputAlign="right" placeholder="请输入"></u-input>
							<text class="unit u-m-l-32">台</text>
						</view>
					</view>
				</u-cell-item>
				<!-- <u-cell-item :arrow="false" :title="addPrefix('BDR销售额占比')">
					<view class="u-flex-col u-col-bottom">
						<view>
							<text>{{ data.Dealer_OtherInfo.PercentageBDRSales }}</text>
							<text class="unit">%</text>
						</view>
						<text class="desc">*上年BDR销售额/总销售额</text>
					</view>
				</u-cell-item> -->
			</view>

			<!-- 门店周边情况 -->
			<view class="" v-show="tabIndex == 3">
				<u-cell-group>
					<u-cell-item v-if="selectedFields.includes(38)" :arrow="false" title="新店所属市级区域供暖市场容量">
						<view class="u-flex-col u-col-bottom">
							<view class="u-flex">
								<u-input disabled v-model="This_Dealer_OtherInfo.AS_HeatingMarketCapacity" type="number" inputAlign="right" placeholder="请输入"></u-input>
								<text class="unit u-m-l-32">台</text>
							</view>
						</view>
					</u-cell-item>

					<u-cell-item v-if="selectedFields.includes(39)" :arrow="false" title="新店所属市级区域热泵市场容量">
						<view class="u-flex-col u-col-bottom">
							<view class="u-flex">
								<u-input disabled v-model="This_Dealer_OtherInfo.AS_HeatPumpMarketCapacity" type="number" inputAlign="right" placeholder="请输入"></u-input>
								<text class="unit u-m-l-32">台</text>
							</view>
						</view>
					</u-cell-item>

					<u-cell-item v-if="selectedFields.includes(40)" :arrow="false" title="周边1公里竞品门店数">
						<u-input disabled v-model="This_Dealer_OtherInfo.AS_CompetingStoresNum" type="number" inputAlign="right" placeholder="请输入"></u-input>
					</u-cell-item>

					<u-cell-item v-if="selectedFields.includes(41)" :arrow="false" title="周边1公里竞品品牌">
						<u-input disabled v-model="This_Dealer_OtherInfo.AS_CompetingBrand" type="number" inputAlign="right" placeholder="请输入"></u-input>
					</u-cell-item>

					<u-cell-item v-if="selectedFields.includes(42)" :arrow="false" title="周边1公里竞品做最好的品牌">
						<u-input disabled v-model="This_Dealer_OtherInfo.AS_BestCompetingBrand" type="number" inputAlign="right" placeholder="请输入"></u-input>
					</u-cell-item>

					<u-cell-item v-if="selectedFields.includes(43)" :arrow="false" title="周边1公里竞品做最好品牌的年供暖销售额">
						<view class="u-flex-col u-col-bottom">
							<view class="u-flex">
								<u-input disabled v-model="This_Dealer_OtherInfo.AS_AnnualHeatingSalesCompetingProducts" type="number" inputAlign="right" placeholder="请输入"></u-input>
								<text class="unit u-m-l-32">万元</text>
							</view>
						</view>
					</u-cell-item>

					<u-cell-item v-if="selectedFields.includes(44)" :arrow="false" title="周边1公里竞品做最好品牌的年热泵销售额">
						<view class="u-flex-col u-col-bottom">
							<view class="u-flex">
								<u-input disabled v-model="This_Dealer_OtherInfo.AS_CompetitiveAnnualHeatPumpSales" type="number" inputAlign="right" placeholder="请输入"></u-input>
								<text class="unit u-m-l-32">万元</text>
							</view>
						</view>
					</u-cell-item>

					<block v-if="selectedFields.includes(45)">
						<u-cell-item title="开店原因" :arrow="false" style="padding-bottom: 0;" :border-bottom="false"></u-cell-item>
						<u-cell-item :arrow="false" style="padding: 0rpx 40rpx;">
							<u-input disabled type="textarea" v-model="This_Dealer_OtherInfo.AS_ReasonOpeningStore"></u-input>
						</u-cell-item>
					</block>

					<u-cell-item v-if="selectedFields.includes(46)" :arrow="false" title="新店预估年壁挂炉台数">
						<view class="u-flex-col u-col-bottom">
							<view class="u-flex">
								<u-input disabled v-model="This_Dealer_OtherInfo.NY_Estimate_FireplaceNum" type="number" inputAlign="right" placeholder="请输入"></u-input>
								<text class="unit u-m-l-32">台</text>
							</view>
						</view>
					</u-cell-item>

					<u-cell-item v-if="selectedFields.includes(47)" :arrow="false" title="新店预估年净水台数">
						<view class="u-flex-col u-col-bottom">
							<view class="u-flex">
								<u-input disabled v-model="This_Dealer_OtherInfo.NY_Estimate_CleanWaterNum" type="number" inputAlign="right" placeholder="请输入"></u-input>
								<text class="unit u-m-l-32">台</text>
							</view>
						</view>
					</u-cell-item>

					<u-cell-item v-if="selectedFields.includes(56)" :arrow="false" title="新店预估年热泵台数">
						<view class="u-flex-col u-col-bottom">
							<view class="u-flex">
								<u-input disabled v-model="This_Dealer_OtherInfo.NY_Estimate_HeatPumpNum" type="number" inputAlign="right" placeholder="请输入"></u-input>
								<text class="unit u-m-l-32">台</text>
							</view>
						</view>
					</u-cell-item>

					<u-cell-item v-if="selectedFields.includes(48)" :arrow="false" title="补贴方式">
						<u-radio-group disabled v-model="This_Dealer_OtherInfo.SubsidyMethod">
							<u-radio name="1">现金</u-radio>
							<u-radio name="2">市场返利</u-radio>
						</u-radio-group>
					</u-cell-item>

					<u-cell-item v-if="selectedFields.includes(57)" :arrow="false" title="申请类型">
						<u-radio-group disabled v-model="This_Dealer_OtherInfo.StoreApplyType">
							<u-radio name="1">焕新</u-radio>
							<u-radio name="2">新建</u-radio>
						</u-radio-group>
					</u-cell-item>
				</u-cell-group>
			</view>

			<!-- 门店展陈信息 -->
			<view class="" v-if="tabIndex == 4">
				<block v-if="selectedFields.includes(60)">
					<u-cell-group>
						<u-cell-item title="门店等级" :arrow="false">
							<u-radio-group disabled v-model="form.VisitRecordInfo.FlagshipState">
								<view class="grid-2">
									<u-radio v-for="(item, index) in DealerGrade_VisitList" :key="index" :name="item.Key">{{ item.Value }}</u-radio>
								</view>
							</u-radio-group>
						</u-cell-item>

						<u-cell-item title="走访模块" :arrow="false" :border-bottom="false"></u-cell-item>
						<u-checkbox-group disabled>
							<view class="visit-grid">
								<view class="visit-item" v-for="(item, index) in DealerVisitCategorylistModel" :key="index">
									<view class="title u-line-1 u-m-b-10">
										<u-checkbox v-model="item.checked" :name="item.Id">{{ item.Name }}</u-checkbox>
									</view>
									<u-image width="100%" :height="200" :src="$getImageUrl(item.Pic)"></u-image>
								</view>
							</view>
						</u-checkbox-group>
					</u-cell-group>
				</block>
			</view>

			<!-- 老板信息 -->
			<view class="" v-if="tabIndex == 5"><boss-information :selectedFields="selectedFields" :displayAll="false" :data="This_Dealer_OtherInfo"></boss-information></view>

			<!-- 门店照片 -->
			<view class="" v-if="tabIndex == 6"><store-photo :list="DoorPhotoList"></store-photo></view>

			<!-- 门店开户照片 -->
			<view class="" v-show="tabIndex == 7"><new-store-photo :showAdd="false" :value="form.InitialStorePhoto"></new-store-photo></view>

			<view class="" v-if="tabIndex == 8"><review-info :data="DealerAuditInfo"></review-info></view>
		</view>

		<view class="btn-group-fixed"><u-button type="warning" @click="backToList">返回列表</u-button></view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			title: '信息审核详情',
			level1TabList: [{ name: '基础信息' }, { name: '产品信息' }, { name: '销售信息' }, { name: '老板信息' }, { name: '处理意见' }],
			level2TabList: [{ name: '基础信息' }, { name: '产品信息' }, { name: '销售信息' }, { name: '老板信息' }, { name: '处理意见' }],
			level3TabList: [
				// { name: '销售业务关系' },
				{ name: '基础信息' },
				{ name: '产品信息' },
				{ name: '销售信息' },
				{ name: '门店周边情况' },
				{ name: '门店展陈信息' },
				{ name: '老板信息' },
				{ name: '门店照片' },
				{ name: '门店开户照片' },
				{ name: '处理意见' }
			],
			
			First_Type_List: [],
			tabIndex: 0,
			InfoId: null,
			ShowLevel: null,
			loadCity: false,

			DataBaseInfo: {},
			DealerAuditInfo: {
				AuditForList: []
			},
			DoorPhotoAuditInfo: {},
			DoorPhotoList: [],
			Door_Dealer_BaseInfo: {},
			Double_Dealer_BaseInfo: {},
			First_Dealer_BaseInfo: {},
			This_Dealer_OtherInfo: {},
			This_Dealer_RelationList: [],

			FirstDealerInfo: {
				Dealer_BaseInfo: {},
				Dealer_OtherInfo: {},
				DealerDetail_Audit: {}
			},
			DoubleDealerInfo: {
				Dealer_BaseInfo: {},
				Dealer_OtherInfo: {},
				DealerDetail_Audit: {}
			},

			fieldOptions: [
				{ label: '销售业务关系', value: 0, checked: false },
				{ label: '经销商名称', value: 1, checked: false },
				{ label: '简称', value: 2, checked: false },
				{ label: '负责人名称', value: 3, checked: false },
				{ label: '负责人手机号', value: 4, checked: false },
				{ label: '地址', value: 5, checked: false },
				{ label: '证照', value: 6, checked: false },
				{ label: '经销协议', value: 7, checked: false },
				{ label: '属性', value: 8, checked: false },
				{ label: '经营品类', value: 9, checked: false },
				{ label: 'BDR品牌数', value: 10, checked: false },
				{ label: '进口品牌数', value: 11, checked: false },
				{ label: '国产品牌数', value: 12, checked: false },
				{ label: '上年BDR销售额', value: 13, checked: false },
				{ label: '总销售额', value: 14, checked: false },
				{ label: 'BDR销售占比', value: 15, checked: false },
				{ label: '人员数量', value: 16, checked: false },
				{ label: '信息收集门店等级', value: 17, checked: false },
				{ label: '走访模块', value: 18, checked: false },
				{ label: 'BDR销售台数', value: 19, checked: false },
				{ label: '总销售台数', value: 20, checked: false },
				{ label: '竞品出样情况', value: 21, checked: false },
				{ label: '竞品走访备注', value: 22, checked: false },
				{ label: '样机情况', value: 23, checked: false },
				{ label: '是否经营两联供', value: 24, checked: false },
				{ label: '我司产品其他信息', value: 25, checked: false },
				{ label: '老板名称', value: 26, checked: false },
				{ label: '老板手机号', value: 27, checked: false },
				{ label: '老板生日', value: 28, checked: false },
				{ label: '是否是VIP', value: 29, checked: false },
				{ label: '祝福备注', value: 30, checked: false },
				{ label: '门店位置', value: 31, checked: false },
				{ label: 'BDR面积', value: 32, checked: false },
				{ label: '店内面积', value: 33, checked: false },
				{ label: '上一年对应代理商供暖销售额', value: 34, checked: false },
				{ label: '上一年对应代理商空凋销售额', value: 35, checked: false },
				{ label: '上一年对应代理商净水销售额', value: 36, checked: false },
				{ label: '新店所属市级区域供暖市场容量', value: 38, checked: false },
				{ label: '新店所属市级区域热泵市场容量', value: 39, checked: false },
				{ label: '周边1公里竞品门店数', value: 40, checked: false },
				{ label: '周边1公里竞品品牌', value: 41, checked: false },
				{ label: '周边1公里竞品做最好的品牌', value: 42, checked: false },
				{ label: '周边1公里竞品做最好品牌的年供暖销售额', value: 43, checked: false },
				{ label: '周边1公里竞品做最好品牌的年热泵销售额', value: 44, checked: false },
				{ label: '开店原因', value: 45, checked: false },
				{ label: '新店预估年壁挂炉台数', value: 46, checked: false },
				{ label: '新店预估年净水台数', value: 47, checked: false },
				{ label: '补贴方式', value: 48, checked: false },
				{ label: '其他产品占用面积', value: 49, checked: false },
				{ label: '上一年此门店供暖销售额', value: 50, checked: false },
				{ label: '上一年此门店空调销售额', value: 51, checked: false },
				{ label: '上一年此门店净水销售额', value: 52, checked: false },
				{ label: '上一年此门店销售BDR供暖产品台数', value: 53, checked: false },
				{ label: '上一年此门店销售BDR净水产品台数', value: 54, checked: false },
				{ label: '上一年此门店销售BDR热泵产品台数', value: 55, checked: false },
				{ label: '新店预估年热泵台数', value: 56, checked: false },
				{ label: '门店申请类型', value: 57, checked: false }
			],

			DealerGrade_VisitList: [],

			DealerVisitCategorylistModel: [],

			currentIndex: 0,

			showBrandPicker: false,

			currentSamplingIndex: 0,

			showProductPicker: false,

			showVisitSellProductPicker: false,

			productOptions: [],

			currentVisitSellIndex: 0,
			showVisitSellPicker: false,

			selectedFields: [],
			Update_Fields_Id: '',

			displayAll: false,

			form: {
				VisitRecordInfo: {
					SalesVolume: '',
					TotalSalesVolume: '',
					Sampling: '',
					VisitRemake: '',
					FlagshipState: '',
					DoubleSupply: '',
					DoubleSupplyString: '',
					OtherBrand: '',
					DealerVisitInfoModelList: [],
					DealerVisitSellList: [],
					DealerSamplingSellList: [],
					ProductOtherInfo: ''
				},
				DealerPeopleNumList: [],
				InitialStorePhoto: []
			}
		};
	},

	onLoad(options) {
		if (options.InfoId) {
			this.InfoId = options.InfoId;
			this.form.Id = options.InfoId;
		}
		if (options.Level) {
			this.ShowLevel = options.Level;
		}

		this.getData();

		if (this.$isWeixin()) {
			this.$setTitle(this.title);
		}

		this.getDealerVisitList();
	},
	methods: {
		backToList() {
			uni.navigateBack();
		},

		getDoorVisitInfo() {
			this.$u.api
				.getDoorVisitInfo({
					DealerId: this.form.DealerId,
					AuditId: this.form.Id
				})
				.then(res => {
					if (res.DealerVisit_Sell) {
						this.form.VisitRecordInfo.DealerVisitSellList = res.DealerVisit_Sell.map((item, index) => {
							let brand = this.DataBaseInfo.CompetingGoodsBrandA_BaseList.find(i => i.Key == item.Brand);

							return {
								BrandName: brand.Value,
								BrandId: item.Brand,
								ProductId: item.ProductId,
								ProductModel: item.ProductModel,
								productName: item.ProductModel,
								Number: item.Number,
								brandIndex: -1,
								productIndex: -1,
								productList: []
							};
						});
					}
				});
		},

		getDoorVisitBrandProductList(brandId, listIndex, type) {
			this.$u.api
				.getDoorVisitBrandProductList({
					BrandId: brandId
				})
				.then(res => {
					console.log(res);
					const { ResultCode, LogisticsList } = res;
					if (ResultCode == 0) {
						if (type == 1) {
							this.form.VisitRecordInfo.DealerSamplingSellList[listIndex].productList = LogisticsList;
						}
						if (type == 2) {
							this.form.VisitRecordInfo.DealerVisitSellList[listIndex].productList = LogisticsList;
						}
					}
				});
		},

		getDealerVisitList() {
			this.$u.api
				.getDealerVisitList({
					DoorType: 1,
					DealerId: this.form.DealerId,
					AuditId: this.InfoId
				})
				.then(res => {
					let {
						DealerVisitCategorylistModel,
						DealerSamplingSellMoodeList,
						DealerGrade_VisitList,
						DealerVisitInfoModelList,
						CompetingGoodsBrandDoubleSupply,
						FlagshipState,
						SalesVolume,
						TotalSalesVolume,
						Sampling,
						OtherBrand,
						DoubleSupply,
						DoubleSupplyString,
						VisitRemake,
						ProductOtherInfo
					} = res;
					this.DealerGrade_VisitList = DealerGrade_VisitList;

					DealerVisitCategorylistModel &&
						DealerVisitCategorylistModel.forEach(item => {
							if (!DealerVisitInfoModelList) {
								DealerVisitInfoModelList = [];
							}

							let imgInfo = DealerVisitInfoModelList.find(info => {
								info.DealerVisitCategoryId == item.Id;
								return (item.checked = item.Id == info.DealerVisitCategoryId);
							});
							item.Pic = '';
							if (imgInfo) {
								item.Pic = imgInfo.Pic;
							}
						});

					this.DealerVisitCategorylistModel = DealerVisitCategorylistModel;
					if (DealerSamplingSellMoodeList && DealerSamplingSellMoodeList.length > 0) {
						this.form.VisitRecordInfo.Sampling = 1;
						DealerSamplingSellMoodeList.forEach(item => (item.productName = item.ProductModel));
						this.form.VisitRecordInfo.DealerSamplingSellList = DealerSamplingSellMoodeList;
					}

					if (CompetingGoodsBrandDoubleSupply) {
						CompetingGoodsBrandDoubleSupply.forEach(item => {
							if (DoubleSupplyString) {
								item.checked = DoubleSupplyString.indexOf(item.Key) > -1;
							}
						});
						this.doubleApplyBrandList = CompetingGoodsBrandDoubleSupply;
					}

					this.form.VisitRecordInfo.FlagshipState = FlagshipState;
					this.form.VisitRecordInfo.SalesVolume = SalesVolume;
					this.form.VisitRecordInfo.TotalSalesVolume = TotalSalesVolume;
					this.form.VisitRecordInfo.Sampling = Sampling;
					this.form.VisitRecordInfo.OtherBrand = OtherBrand;
					this.form.VisitRecordInfo.DoubleSupply = DoubleSupply;
					this.form.VisitRecordInfo.VisitRemake = VisitRemake;
					this.form.VisitRecordInfo.ProductOtherInfo = ProductOtherInfo;
				});
		},

		initFields(This_Dealer_OtherInfo) {
			if (This_Dealer_OtherInfo) {
				if (This_Dealer_OtherInfo.Update_Fields_Id) {
					this.Update_Fields_Id = This_Dealer_OtherInfo.Update_Fields_Id.split(',').map(Number);
					this.selectedFields = this.Update_Fields_Id;
				} else {
					this.selectedFields = this.fieldOptions.map(item => Number(item.value));
					this.Update_Fields_Text = this.fieldOptions.map(item => item.label);
					this.Update_Fields_Id = this.fieldOptions.map(item => Number(item.value));
				}
			}
		},

		addPrefix(text) {
			let prefix = '';
			if (this.ShowLevel == 1) {
				prefix = '一级';
			}
			if (this.ShowLevel == 2) {
				prefix = '二级';
			}
			if (this.ShowLevel == 3) {
				prefix = '门店';
			}
			return prefix + text;
		},

		getData() {
			this.$u.api
				.getInformationReviewDetail({
					InfoId: this.InfoId
				})
				.then(res => {
					const {
						ShowLevel,
						DataBaseInfo,
						DealerAuditInfo,
						DoorPhotoAuditInfo,
						DoorPhotoList,
						Door_Dealer_BaseInfo,
						Double_Dealer_BaseInfo,
						First_Dealer_BaseInfo,
						ResultCode,
						This_Dealer_OtherInfo,
						This_Dealer_RelationList,
						AuditForList,
						DealerPeopleNumList,
						InitialStorePhoto,
						Store_Location_List,
						First_Type_List
					} = res;
					console.log(res);
					if (ResultCode === 1) {
						this.ShowLevel = ShowLevel;
						
						if(First_Type_List) {
							First_Type_List.forEach(item => {
								let firstType = This_Dealer_OtherInfo.First_Type ? This_Dealer_OtherInfo.First_Type : '';
								const checked = firstType.split(',').indexOf(String(item.Key)) > -1;
								this.$set(item, 'checked', checked);
							});
							this.First_Type_List = First_Type_List;
						}

						if (Store_Location_List) {
							let storeLocation = This_Dealer_OtherInfo.Store_Location;
							if (storeLocation) {
								const location = Store_Location_List.find(item => item.Key == storeLocation);

								if (location) {
									This_Dealer_OtherInfo.Store_Location = location.Value;
								}
							}
						}

						this.initFields(This_Dealer_OtherInfo);

						if (this.ShowLevel == 3) {
							this.form.InitialStorePhoto = InitialStorePhoto;
						}

						if (DataBaseInfo) {
							this.DataBaseInfo = DataBaseInfo;
						}
						if (DealerAuditInfo) {
							this.DealerAuditInfo = DealerAuditInfo;
							this.DealerAuditInfo.AuditForList = AuditForList;
						}
						if (DoorPhotoAuditInfo) {
							this.DoorPhotoAuditInfo = DoorPhotoAuditInfo;
						}
						if (DoorPhotoList) {
							this.DoorPhotoList = DoorPhotoList;
						}
						if (Door_Dealer_BaseInfo) {
							this.Door_Dealer_BaseInfo = Door_Dealer_BaseInfo;
						}
						if (Double_Dealer_BaseInfo) {
							this.Double_Dealer_BaseInfo = Double_Dealer_BaseInfo;
						}
						if (First_Dealer_BaseInfo) {
							this.First_Dealer_BaseInfo = First_Dealer_BaseInfo;
						}
						if (This_Dealer_OtherInfo) {
							this.This_Dealer_OtherInfo = This_Dealer_OtherInfo;
							this.form.This_Dealer_OtherInfo = { ...this.form.This_Dealer_OtherInfo, ...This_Dealer_OtherInfo };
						}
						if (This_Dealer_RelationList) {
							this.This_Dealer_RelationList = This_Dealer_RelationList;
						}

						if (ShowLevel == 1) {
							this.FirstDealerInfo.Dealer_BaseInfo = First_Dealer_BaseInfo;
							this.FirstDealerInfo.Dealer_OtherInfo = This_Dealer_OtherInfo;
							this.FirstDealerInfo.DealerDetail_Audit = DealerAuditInfo;
						}

						if (ShowLevel == 2) {
							this.DoubleDealerInfo.Dealer_BaseInfo = Double_Dealer_BaseInfo;
							this.DoubleDealerInfo.Dealer_OtherInfo = This_Dealer_OtherInfo;
							this.DoubleDealerInfo.DealerDetail_Audit = DealerAuditInfo;
						}

						if (ShowLevel == 3) {
							this.DoubleDealerInfo.Dealer_BaseInfo = Door_Dealer_BaseInfo;
							this.DoubleDealerInfo.Dealer_OtherInfo = This_Dealer_OtherInfo;
							this.DoubleDealerInfo.DealerDetail_Audit = DealerAuditInfo;
						}

						// if (ShowLevel != 3) {
						this.DataBaseInfo.BusinessCategory_BaseList.forEach(item => {
							item.checked = This_Dealer_OtherInfo.BusinessCategory.split(',').indexOf(String(item.Key)) > -1;
						});
						this.DataBaseInfo.CompetingGoodsBrandA_BaseList.forEach(item => {
							item.checked = This_Dealer_OtherInfo.CompetingGoodsBrandA.split(',').indexOf(String(item.Key)) > -1;
						});
						this.DataBaseInfo.CompetingGoodsBrandB_BaseList.forEach(item => {
							item.checked = This_Dealer_OtherInfo.CompetingGoodsBrandB.split(',').indexOf(String(item.Key)) > -1;
						});
						this.DataBaseInfo.CompetingGoodsBrandC_BaseList.forEach(item => {
							item.checked = This_Dealer_OtherInfo.CompetingGoodsBrandC.split(',').indexOf(String(item.Key)) > -1;
						});
						// }

						this.loadCity = true;

						this.form.DealerPeopleNumList = DealerPeopleNumList;

						this.getDoorVisitInfo();
					}
				});
		}
	},

	computed: {
		count_A() {
			if (!this.DataBaseInfo.CompetingGoodsBrandA_BaseList) {
				return 0;
			}
			return this.DataBaseInfo.CompetingGoodsBrandA_BaseList.filter(item => item.checked).length;
		},
		count_B() {
			if (!this.DataBaseInfo.CompetingGoodsBrandB_BaseList) {
				return 0;
			}
			return this.DataBaseInfo.CompetingGoodsBrandB_BaseList.filter(item => item.checked).length;
		},
		count_C() {
			if (!this.DataBaseInfo.CompetingGoodsBrandC_BaseList) {
				return 0;
			}
			return this.DataBaseInfo.CompetingGoodsBrandC_BaseList.filter(item => item.checked).length;
		},
		tabList() {
			if (this.ShowLevel == 1) {
				return this.level1TabList;
			} else if (this.ShowLevel == 2) {
				return this.level2TabList;
			} else {
				return this.level3TabList;
			}
		},
		percentOfSalesVolume() {
			let SalesVolume = this.form.VisitRecordInfo.SalesVolume;
			let TotalSalesVolume = this.form.VisitRecordInfo.TotalSalesVolume;

			if (!TotalSalesVolume) {
				return 0;
			}

			if (!SalesVolume) {
				return 0;
			}
			return ((SalesVolume / TotalSalesVolume) * 100).toFixed(2);
		}
	}
};
</script>

<style lang="scss">
.visit-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	grid-auto-rows: 240rpx;
	gap: 20rpx 20rpx;
	padding: 20rpx;

	.visit-item {
		display: flex;
		flex-direction: column;
		text-align: left;

		.title {
			width: 200rpx;
		}
	}
}

.samling-item {
	background-color: #ffffff;
	padding: 0 20rpx;
}
</style>
